/********************************************************************************
 *      Copyright:  (C) 2025 LingYun IoT System Studio
 *                  All rights reserved.
 *
 *       Filename:  sampling.h
 *    Description:  This file 
 *
 *        Version:  1.0.0(01/05/25)
 *         Author:  Guo Wenxue <guowenxue@gmail.com>
 *      ChangeLog:  1, Release initial version on "01/05/25 17:43:44"
 *                 
 ********************************************************************************/

#ifndef    PACKET_H
#define    PACKET_H

#include <time.h>
#include <string.h>
#include <stdint.h>

typedef struct pack_data_s
{
    float               temperature;
    char                device[32];
    struct tm           time;
}pack_data_t;

typedef int (* pack_proc_t)(pack_data_t *pack_data, uint8_t *pack_buf, int size);

int sampling(pack_data_t *data);
int packet_segmented_pack(pack_data_t *pack_data, uint8_t *pack_buf, int size);
int packet_json_pack(pack_data_t *pack_data, uint8_t *pack_buf, int size);
static uint16_t crc_itu_t(const uint8_t *data, size_t length);
int packet_tlv_pack(pack_data_t *pack_data, uint8_t *pack_buf, int size);



#endif
